package server.analytics;

/**
 * This rmi - interface defines two methods to be invoked remote.
 * 
 * @version 1.0 vom 20.11.2012
 * @author Distributed Group 111 1026312, 1026309
 */

import java.rmi.Remote;
import java.rmi.RemoteException;

import model.event.Event;

public interface Subscription extends Remote {

	/**
	 * Adds a new regular expression to the regex-list
	 */
	/**
	 * @param newRegex
	 *            the new regular expression that should be added.
	 * @return a unique subscription-identifier or -1 if regex is not ok, or if
	 *         that regex is already in the regex-list
	 * @throws RemoteException
	 *             thrown if any remote-exception occurs.
	 */
	int addRegex(String newRegex) throws RemoteException;

	/**
	 * Removes a regular expression subscription with the specified id from the
	 * regex-list
	 * 
	 * @param subscriptionId
	 *            the subscription id that should be deleted.
	 * @return true if the subscription with that id has been removed.
	 * @throws RemoteException
	 *             thrown if any remote-exception occurs.
	 */
	boolean removeRegex(int subscriptionId) throws RemoteException;
	
	/**
	 * Check if the EventType of that event matches with any subscription of
	 * that subscriber. If that happens, send a notification to the mgmtclient.
	 * 
	 * @param event
	 *            the event that occured
	 * @throws RemoteException
	 *             thrown if any remote-exception occurs.
	 */
	void notificate(Event event) throws RemoteException;
}